﻿/**
 * 
 * Copyright 2009, 2010 Mike Jamer [email: mikejamer@gmail.com ]
 * 
 * This File is part of Moose IRC
 * 
 * MooseIRC is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * MooseIRC is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with MooseIRC.  If not, see <http://www.gnu.org/licenses/>.
 * 
 */

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Text;
using moose.irc;

namespace MooseIRC.Client.Server {

    /// <summary>
    /// Channel Client
    /// </summary>
    internal class ChannelClient : Client {

        /// <summary>
        /// Entity that this channel relates to...
        /// </summary>
        private IrcEntity m_entity;

        /// <summary>
        /// Initialize Channel Client
        /// </summary>
        /// <param name="socket"></param>
        public ChannelClient(Socket socket, IrcEntity entity)
            : base(socket) {
                m_entity = entity;
            return;
        }

        /// <summary>
        /// Process Client message
        /// </summary>
        /// <param name="response">Client Response</param>
        protected override void dispatch_client(string response) {
            //the response is likely just text, so if it is, treat it as a private message,
            //otherwise, treat it as a raw message

            if (response[0] == '/')
            { //Send everything but the leading '/' to the irc session
                
            }
            else if (response[0] == '!')
            { //this should be processed by the server, not the irc session, send everything, even the leading '!'
            }
            else
            {
                response = "PRIVMSG " + m_entity.Name + " :" + response;
                //Send this to the irc session
            }
            return;
        }

    }
}
